import socket,time
# 创建客户端套接字
client= socket.socket()

client.connect(("127.0.0.1",8808))

# 创建文件,读取内容并向服务器以1024字节速度传递
f = open("1.png", "rb")
end = f.seek(0, 2)
f.seek(0, 0)
while f.tell() != end:
    data = f.read(1024)
    client.send(data)
    time.sleep(1)
    if data:
        data_from_server=client.recv(1024).decode("utf-8")
        print("server message:",data_from_server)
f.close()
client.close()